package com.webdemo10.action;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.webdemo10.pojo.User;
import com.webdemo10.service.UserService;
@Controller
@Namespace("/ssh/jsp")
@Action(value="queryUser",results={@Result(location="/WEB-INF/jsp/show.jsp")})
public class QueryUser extends ActionSupport {
	private static final long serialVersionUID = 1L;
	@Autowired
	private UserService userService;
	@Override
	public String execute() throws Exception {
		List<User> users = userService.getUsers();
		ActionContext.getContext().put("users", users);
		return SUCCESS;
	}
}
